package com.smart.util;


import com.smart.model.authority.Button;
import com.smart.model.authority.Menu;

import net.sf.json.JSONObject;

public class AuthorityMenuUtil {
	   public static String getMenu(String type)
		{
			   Button buttonDelivery=new Button();
		       buttonDelivery.setName("快递管理");
		       buttonDelivery.setUrl("/SmartCommunity/views/pc/delivery.html");
		       
		       Button buttonNotice=new Button();
		       buttonNotice.setName("发送通知");
		       Button buttonFareNotice=new Button();
		       buttonFareNotice.setName("缴费通知");
		       buttonFareNotice.setUrl("/SmartCommunity/views/pc/send-fare.html");
		       Button buttonCommunityNotice=new Button();
		       buttonCommunityNotice.setName("小区通知");
		       buttonCommunityNotice.setUrl("/SmartCommunity/views/pc/send-community.html");
		       buttonNotice.setSubButton(new Button[]{buttonFareNotice,buttonCommunityNotice});
		       
		       Button buttonRepair=new Button();
		       buttonRepair.setType("red");
		       buttonRepair.setName("报修处理");
		       buttonRepair.setUrl("/SmartCommunity/views/pc/repair.html");
		       
		       Button buttonAuth=new Button();
		       buttonAuth.setName("业主管理");
		       buttonAuth.setUrl("/SmartCommunity/views/pc/authentication.html");
		       
		       
		       Button buttonMagUser=new Button();
		       buttonMagUser.setName("用户管理");
		       buttonMagUser.setUrl("/SmartCommunity/views/pc/user.html");
		       
		       Button buttonEditor=new Button();
		       buttonEditor.setName("广告编辑");
		       buttonEditor.setUrl("/SmartCommunity/views/pc/editor.html");
		       
		       Menu menu=new Menu();
		       Button[] button;
		       //role_ordinary_amin,role_super_admin,role_delivery
		       if(type.equals("role_super_admin"))
		       {
		    	   button=new Button[]{buttonDelivery,buttonNotice,buttonMagUser,buttonAuth,buttonRepair,buttonEditor};
		       }
		       else if(type.equals("role_ordinary_amin"))
		       {
		    	   button=new Button[]{buttonDelivery,buttonNotice,buttonAuth,buttonRepair,buttonEditor};
		       }
		       else
		       {
		    	   button=new Button[]{buttonDelivery};
		       }
		       menu.setButton(button);
		       
		      return JSONObject.fromObject(menu).toString();
		}
	   public static void main(String[] args)
	   {
		   String type="role_super_admin";
//			String type="role_ordinary_amin";
//			String type="role_delivery";
		   System.out.println(getMenu(type));
	   }
}
